---
title: SAIF.Services.Appworx business rules
summary: Enumerated business rules with per-rule trigger, enforcement, and outcomes.
status: draft
owner: <owner>
last_reviewed: 2026-08-25
library: SAIF.Services.Appworx
reference_type: package
---

# SAIF.Services.Appworx business rules

This page captures business rules enforced by this library.

## BR-APX-001 Optional arguments omitted when empty

| Field | Value |
| --- | --- |
| **Statement** | When submitting an Appworx job, an argument slot (`Arg1`–`Arg20`) is included as a stored-procedure parameter only if its `clsSmartString` value is not empty. |
| **Trigger** | `SubmitBatchJob()` instance method execution. |
| **Enforcement** | `If Not m_ArgN.IsEmpty Then DataRequest.AddParm("inArgN", ArgN, 4000)` for each of the 20 argument slots. |
| **Outcome** | The `submit_appworx_job` stored procedure receives only the populated arguments as bound parameters; unpopulated slots are omitted rather than passed as empty/null values. |
| **SQL** | [SQL-APPWORX-001](sql/SQL-APPWORX-001-submit-appworx-job.md) |
| **Source** | `SAIF.Services.Appworx\clsRequestAppworxJob.vb` (`SubmitBatchJob`) |

---

## BR-APX-002 Submission failures are wrapped and rethrown

| Field | Value |
| --- | --- |
| **Statement** | Any exception raised while processing the Appworx job submission portal request is caught and rethrown as an `ApplicationException` with a fixed prefix message and the original exception as inner exception. |
| **Trigger** | An exception thrown by `DPI.ProcessPortalRequest(PortalRequest)` inside `SubmitBatchJob()`. |
| **Enforcement** | `Catch ex As Exception` → `Throw New ApplicationException("Error Submiting Appworx Job " & ex.Message, ex)`. |
| **Outcome** | Callers see a uniform `ApplicationException` (message contains a typo, "Submiting", present verbatim in source) regardless of the underlying data-access failure cause; the original exception is preserved as `InnerException`. |
| **SQL** | [SQL-APPWORX-001](sql/SQL-APPWORX-001-submit-appworx-job.md) |
| **Source** | `SAIF.Services.Appworx\clsRequestAppworxJob.vb` (`SubmitBatchJob`) |

---

## BR-APX-003 Non-production Appworx target override

| Field | Value |
| --- | --- |
| **Statement** | When the shared `SubmitBatchJob` overload is called with `inUseWCISDEV1AppworxForAllDevEnv = True`, the job is submitted against a fixed Oracle target (`WCISPROD` in Prod, `WCISDEV1` otherwise) using schema `PRADT`, instead of the caller-supplied data portal. |
| **Trigger** | Shared `SubmitBatchJob(...)` overload invoked with `inUseWCISDEV1AppworxForAllDevEnv:=True`. |
| **Enforcement** | `If inUseWCISDEV1AppworxForAllDevEnv Then` branches on `AppGlobal.EnvironmentService.GetApplicationEnvironment()`: when the result is `ApplicationEnvironment.Prod`, `lDAL = New clsMSOracleDataLayer("PRADT", "WCISPROD")`; otherwise (any non-production environment), `lDAL = New clsMSOracleDataLayer("PRADT", "WCISDEV1")`. The resulting `lDAL` is then used to construct the `IDataPortalInfo` passed to the new `clsRequestAppworxJob` instance instead of the caller-supplied data portal. |
| **Outcome** | All non-production environments funnel Appworx submissions through a single shared `WCISDEV1` Appworx/Oracle target when this flag is set, avoiding per-environment Appworx configuration drift. |
| **SQL** | [SQL-APPWORX-001](sql/SQL-APPWORX-001-submit-appworx-job.md) |
| **Source** | `SAIF.Services.Appworx\clsRequestAppworxJob.vb` (Shared `SubmitBatchJob`) |

---

## BR-APX-004 Unspecified arguments left unset in shared overload

| Field | Value |
| --- | --- |
| **Statement** | In the shared `SubmitBatchJob` convenience overload, an optional argument parameter (`inArg1`–`inArg20`) is only assigned to the underlying instance property if the caller passed a non-`Nothing` value; omitted arguments retain their default empty state from `InitArgs()`. |
| **Trigger** | Shared `SubmitBatchJob(...)` overload execution, per-argument. |
| **Enforcement** | `If inArgN IsNot Nothing Then .ArgN = inArgN End If` for each of the 20 optional argument parameters. |
| **Outcome** | Combined with [BR-APX-001](#br-apx-001-optional-arguments-omitted-when-empty), an argument omitted (or passed as `Nothing`) by the caller of the shared overload is never sent to the stored procedure at all. |
| **SQL** | [SQL-APPWORX-001](sql/SQL-APPWORX-001-submit-appworx-job.md) |
| **Source** | `SAIF.Services.Appworx\clsRequestAppworxJob.vb` (Shared `SubmitBatchJob`) |

## Stored procedure business rules

The retrieved Oracle source for `WCIS_DBA.submit_appworx_job` exposes the following server-side rules.

| Rule ID | Rule | Source | Link |
| --- | --- | --- | --- |
| [BR-APX-005](procedures/submit-appworx-job.md#br-apx-005-job-id-comes-from-so_max_jobid-sequence) | Each execution assigns `JOB_QUEUE.JOBID` from `SO_MAX_JOBID.NEXTVAL`. | `WCIS_DBA.submit_appworx_job` | [Details](procedures/submit-appworx-job.md#br-apx-005-job-id-comes-from-so_max_jobid-sequence) |
| [BR-APX-006](procedures/submit-appworx-job.md#br-apx-006-queue-rows-use-a-fixed-master_job_number) | Every inserted row uses a fixed `MASTER_JOB_NUMBER` value of `-1`. | `WCIS_DBA.submit_appworx_job` | [Details](procedures/submit-appworx-job.md#br-apx-006-queue-rows-use-a-fixed-master_job_number) |
| [BR-APX-007](procedures/submit-appworx-job.md#br-apx-007-optional-arguments-default-to-empty-strings) | `inarg1` through `inarg20` default to `''` when callers omit them. | `WCIS_DBA.submit_appworx_job` | [Details](procedures/submit-appworx-job.md#br-apx-007-optional-arguments-default-to-empty-strings) |
| [BR-APX-008](procedures/submit-appworx-job.md#br-apx-008-no_data_found-is-ignored) | `NO_DATA_FOUND` is swallowed without raising an error to the caller. | `WCIS_DBA.submit_appworx_job` | [Details](procedures/submit-appworx-job.md#br-apx-008-no_data_found-is-ignored) |
| [BR-APX-009](procedures/submit-appworx-job.md#br-apx-009-other-exceptions-are-re-raised) | All non-`NO_DATA_FOUND` exceptions are re-raised. | `WCIS_DBA.submit_appworx_job` | [Details](procedures/submit-appworx-job.md#br-apx-009-other-exceptions-are-re-raised) |

## Related documentation
- [Index](index.md)
- [Overview](overview.md)
- [Architecture](architecture.md)
- [Dependencies](dependencies.md)
- [Operations and processes](operations-processes.md)
- [Database tables](database-tables.md)
- [Configuration](configuration.md)
- [SQL catalog](sql/index.md)
- [Stored procedures](procedures/index.md)
- [API reference](api/index.md)

## Sources
- `SAIF.Services.Appworx\clsRequestAppworxJob.vb`
- Oracle retrieval: `C:\Users\chrfre\AppData\Local\Temp\oracle-sources\submit_appworx_job.json`
